
import java.util.Scanner;

class COFRE {

    public static void main(String[] args) {
        Scanner entrada = new Scanner(System.in);

        int N;
        int n = 1;

        while ((N = entrada.nextInt()) != 0) {
            int J = 0, Z = 0;
            System.out.println("Teste " + n++);
            for (int i = 0; i < N; i++) {
                J += entrada.nextInt();
                Z += entrada.nextInt();
                System.out.println(J - Z);
            }
        }
    }
}
